<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@include file= "/WEB-INF/pages/base/commImportPage.jsp" %><html>
<head>
    <title>菜单管理</title><!-- 功能菜单管理 -->
    <meta charset="utf-8">
    <!--[if lt IE 9]><script src="../../js/comm/css3-mediaqueries.js"></script><![endif]-->
    <link rel="stylesheet" type="text/css" href="${resourcePath}/tags/bootstrap/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/new/comm/base_v3.0.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/new/pipedata.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/comm/paging.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/settings.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/new/comm/Package.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/new/pig.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/insp.css">
    <link rel="stylesheet" type="text/css" href="${resourcePath}/css/comm/NewBtn.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/tool.js"></script>
    <script type="text/javascript">
        var pagePath="${pageContext.request.contextPath}";
        var head=[
            {id:"cpy",name:'选择',style:'width:5%;'},
            {id:"NUM",name:'序号', fn : function(data) {return  parseInt(data.NUM, 10);},style:'width:10%;'},
            {id:"MENUNAME",name:'菜单',style:'width:10%;'},
            {id:"MENUCODE",name:'菜单编号',style:'width:10%;'},
            {id:"URL",name:'路径',style:'width:30%;'},
            {id:"IMGURL",name:'图片',style:'width:15%;'},
            {id:"STATE",name:'状态',fn:function(data){return '<em style="margin-left:6px;" data="'+data["ID_"]+'" class="on-off '+(data['STATE_']==0?"active":"")+'"></em>'},style:'width:10%;'},
            {id:'1',name:'<em class="xq-icon" ></em>',className:'xq-icon1',style:'width:10%;'}
        ];

        $(function(){
            page.init(head,$("#searchBody"));
            $('.on-off').live('click',function(){

                resultAjax("<%=request.getContextPath()%>/settings/prvlg/menu/updateMenuState.json","id="+$(this).attr("data")+"&STATE="+($(this).hasClass('active')?1:0),function(data,obj){
                    if(data.status == 0)
                    {
                        if(!obj.hasClass('active')){
                            //alert("");
//                        flashMessage_("操作成功！");

                        }
                        obj.hasClass('active')?obj.removeClass('active'):obj.addClass("active");
                    }else{
                        alert("操作失败！");
                    }

                },"JSON",$(this));
            });

            $(".btnCtr").click(function(){
                var data="1=1&STATE="+$(this).attr("state");
                $(".main .info-header .info-tr .table-ck  i.active").each(function(){
                    data+="&id="+pageData[$(this).parent().parent().parent().parent().parent().attr("item")]["ID_"];
                });
                if($(".main .info-header .info-tr .table-ck  i.active").length > 0)
                {
                    resultAjax("<%=request.getContextPath()%>/settings/prvlg/menu/updateMenuState.json",data,function(data,obj){
                        if(data.status == 0)
                        {
                            alert("操作成功！");
                            search(1,100);
                        }else{
                            alert("操作失败！");
                        }

                    },"JSON",$(this));
                }
            }) ;

            $(".btnSubmit").unbind("click").click(function(){
                $("#add").submit();
            })

            $("#btn-search-icon").unbind();

        })

        $(".btnEdit").live("click",function(){
            var data=pageData[$(this).parent().parent().parent().attr("item")];
            $("#add .PopupTitle").html("编辑菜单信息");
            $("#add").attr("url","<%=request.getContextPath() %>/settings/prvlg/menu/updateMenu.json?id="+data["ID_"]);
            $("#add").initData(data);
            $("#add").modal();

        })



        handle=function(data){
            return  '<a href="#add"  data="'+data["ID_"]+'"class="btnEdit edit0" style="margin-left:17px"></a>';
        }

        function mysearch(){
            search(1,$(".paging-footer .down-list .total").text());
        }

    </script>
</head>

<body class="body-pad" style="padding-bottom:100px">
<div class="html-header" style="background-color:white" searchUrl="<%=request.getContextPath() %>/settings/prvlg/getMenus.json">
    <p class="header-title"><em class="seting-gdgn" style="margin-left:20px"></em>功能菜单管理</p>
</div>
<div class="container-fluid warp insp-container">
    <div class="row-fluid  bg-white1">
        <div class="main clearFix">
            <div class="cxtj clearFix dataList">
                <div class="fxgl">
                    <p class="fxgl-title">菜单名</p>
                    <div class="sel w320">
                        <input type="text" placeholder="输入菜单名"  class="new-input" data-name="NAME"/>
                    </div>
                </div>
                <p class="fxgl-title" style="color:white;margin-bottom:10px">ioio</p>
                <a href="javascript:void(0)" onclick="mysearch()" class="zy-button zy-search btn-search-icon" id="btn-search-icon" style="padding:8px 35px 11px 35px; !important;">查询</a>
                <div style="clear:both"></div>
                <p class="tool pad20" style="margin-top:-42px">
                    <a href="javascript:void(0);" class="btn btn-w100 btn-stop-bg btn-h30 btnCtr" state="1"><em></em>停用</a>
                    <a href="javascript:void(0);" class="btn btn-w100 btn-qy-bg btn-h30 btnCtr" state="0"><em></em>启用</a>
                </p>
                <div style="clear:both"></div>
                <div class="l-r clearFix pad20" >
                    <div class="left" style="border-bottom:1px solid #d7dde9">
                        <div class="info-header clearFix" >
                            <ul class="ul-header head" >
                                <li class="sw5-1">
                                <span class="table-ck" style="width:5%">
                                    <span class="check-box selected " onclick=""><i></i></span>
                                </span>
                                </li>
                                <li class="w12-3">序号</li>
                                <li class="sw15-5" style="padding: 0 0px;width:10%">菜单名</li>
                                <li class="sw10-4" style="padding: 0 0px;width:10%">菜单编号</li>
                                <li class="sw10" style="padding: 0 0px;width:30%">路径</li>
                                <li class="sw10-1" style="padding: 0 0px;width:15%">图片</li>
                                <li class="sw10-3" style="padding: 0 0px;width:10%">状态</li>
                                <li class="w15-3 no-right" style="padding: 0 0px;width:10%">编辑</li>
                            </ul>
                            <div class="div-scrol" id="searchBody">
                                <div class="info-tr" >
                                    <ul class="ul-header bg-white">
                                        <li class="w5">
                                        <span class="table-ck">
                                             <span class="check-box selected " onclick=""><i></i></span>
                                        </span>
                                        </li>
                                        <li class="w15-2"></li>
                                        <li class="w15"></li>
                                        <li class="w10"></li>
                                        <li class="w10" width:37%></li>
                                        <li class="w10"></li>
                                        <li class="w10"><em class="on-off"></em></li>
                                        <li class="w15-3 no-right">
                                            <a href=""  class="edit0" ></a>
                                        </li>
                                    </ul>
                                    <div class="show-ul none"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>






        </div>
    </div>
</div>

<!-- 编辑弹出层 -->
<div id="add" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h3 class="PopupTitle" style="text-align:center">编辑菜单信息</h3>
    </div>
    <div class="modal-body copy-tan">
        <ul class="ul-title">
            <li>菜单名称 </li>
            <li>菜单编号</li>
        </ul>
        <ul class="u-info">
            <li class="li1" style="border-bottom:none">
                <div class="sel w410">
                    <input type="text" placeholder="菜单名称"  style="width:288px;margin-top:5px" data-name="MENUNAME">
                </div>
            </li>
            <li class="li1" style="border-bottom:none">
                <div class="sel w410" >
                    <input type="text" placeholder="菜单编号" style="width:288px;margin-top:5px" data-name="MENUCODE">
                </div>
            </li>

            <ul class="ul-title">
                <li>排序 </li>
                <li>&nbsp;</li>
            </ul>
            <li class="li1" style="border-bottom:none">
                <div class="sel w410" >
                    <input onkeypress="return inputOnlyNUM(event,this)" type="text" placeholder="排序号" style="width:288px;margin-top:5px" data-name="SORT">
                </div>
            </li>
            <li class="li1" style="border-bottom:none">
                <div class="sel w410" >
                </div>
            </li>

            <ul class="ul-title">
                <li>路径 </li>
                <li>图片</li>
            </ul>
            <li class="li1" style="border-bottom:none">
                <div class="sel w410" >
                    <input type="text" placeholder="路径" style="width:288px;margin-top:5px" data-name="URL">
                </div>
            </li>
            <li class="li1" style="border-bottom:none">
                <div class="sel w410" >
                    <input type="text" placeholder="图片" style="width:288px;margin-top:5px" data-name="IMGURL">
                </div>
            </li>
        </ul>

        <p class="qg-text" style="margin-top:30px;width:100%"><textarea rows="" cols="" placeholder="备注" data-name="CREATE_REMARK"></textarea></p>
    </div>
    <div class="modal-footer" style="text-align:center">
        <button  class="btn btn-w140 btn-save-icon btn-h40 btnSubmit" ><em style="top:10px;left:35px" ></em>确定</button>
    </div>
</div>
</body>

</html>